<?php
header('content-type:text/html;charset=utf-8');
try {
	$pdo=new PDO('mysql:host=localhost; dbname=exercise','root','root');
	
	$sql = 'delete from user1 where id=1';
	$res = $pdo->exec($sql);
	
	if($res==FALSE) {
		//错误信息：42S02
		echo $pdo->errorCode();
		echo "<hr/>";
		//Array ( [0] => 42S02 [1] => 1146 [2] => Table 'exercise.user1' doesn't exist )
		$errInfo = $pdo->errorInfo();
		print_r($errInfo);
	}
	
} catch(PDOException $e) {
	echo $e->getMessage();
}
?>